Skip to content

feat(data-table): add filter policy support - #431

Closed
IzumiSy wants to merge 6 commits into
mainfrom
feat/data-table-filter-policy
Closed

feat(data-table): add filter policy support#431
IzumiSy wants to merge 6 commits into
mainfrom
feat/data-table-filter-policy

Conversation

@IzumiSy

@IzumiSy IzumiSy commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Motivation

Some backends only expose a subset of the DataTable filter surface. In particular, operator support can vary per field type, and regex-backed case-insensitive string filtering may be unavailable. Without a way to express those limits, inferred filter UIs could offer controls that the backend cannot execute, and URL-backed filter state could restore unsupported operators.

Design Decision

Chosen approach

Expose backend-wide filter defaults through filterPolicy, applied where metadata-derived FilterConfig objects are created.

This keeps the main override point close to inferColumns() and fieldTypeToFilterConfig(), which already translate metadata into filter behavior. The resolved FilterConfig then drives both the visible filter UI and URL-state hydration.

URL state behavior

useURLCollectionVariables() and withURLCollectionState() now accept the same filterPolicy so URL hydration validates operators against the effective filter config.

For string filters, URL hydration restores the field's default case-sensitivity from supportsCaseInsensitive instead of adding a new URL format for that flag.

Alternatives considered

A control-level capability API was considered, but that would push backend policy into runtime control wiring for a case that is usually static per app/backend. A metadata/inference-level policy keeps the common path smaller and avoids extra wrapper code for each table.

Summary

  • add operators and supportsCaseInsensitive to FilterConfig, plus public FilterPolicy support in metadata-derived filter config helpers
  • allow inferColumns() to apply backend-wide filter policy defaults to inferred filter configs
  • make DataTable filter UI and URL-backed collection state respect the effective filter policy

@IzumiSy
IzumiSy force-pushed the feat/data-table-filter-policy branch from f52c32e to cbe5f8d Compare August 18, 2026 00:39
@IzumiSy

IzumiSy commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

/review

@github-actions

github-actions Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

API Design Review completed successfully!

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generated by API Design Review for issue #431 · 59.9 AIC · ⌖ 6.18 AIC · ⊞ 5.8K
Comment /review to run again

Comment thread packages/core/src/lib/collection-url-state.ts
Comment thread packages/core/src/components/data-table/field-helpers.ts
@IzumiSy

IzumiSy commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

/review

@github-actions

github-actions Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Code Review completed successfully!

Code review complete. Both previously raised issues (Medium: silent caseSensitive shape change; Low: empty interface extension) have been resolved by the author. No new High or Medium issues found. Verdict: Approve — the filterPolicy implementation is correct, backward-compatible, and well-tested.

@github-actions

github-actions Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Code Metrics Report

main (7a727b1) #431 (5288147) +/-
Coverage 90.0% 90.0% +0.0%
Test Execution Time 1m47s 1m55s +8s
Details
  |                     | main (7a727b1) | #431 (5288147) |  +/-  |
  |---------------------|----------------|----------------|-------|
+ | Coverage            |          90.0% |          90.0% | +0.0% |
  |   Files             |            125 |            125 |     0 |
  |   Lines             |           5165 |           5183 |   +18 |
+ |   Covered           |           4650 |           4668 |   +18 |
- | Test Execution Time |          1m47s |          1m55s |   +8s |

Code coverage of files in pull request scope (80.4% → 80.9%)

Files Coverage +/- Status
packages/core/src/components/data-table/field-helpers.ts 100.0% 0.0% modified
packages/core/src/components/data-table/toolbar.tsx 77.9% +0.3% modified
packages/core/src/lib/collection-url-state.ts 92.7% +0.5% modified
packages/core/src/types/collection.ts 95.4% +0.4% modified

Reported by octocov

@IzumiSy IzumiSy closed this Aug 21, 2026
@IzumiSy
IzumiSy deleted the feat/data-table-filter-policy branch August 21, 2026 02:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant